/*!
 * novem | Multi-Purpose & Bootstrap 5.x based HTML Template
 * Copyright Anovem
 * Theme scripts & styles
 * 
 * @version: v2.0.0
 * @create: 2022/05/21
 * @update: 2024/11/17 23:12:38
 * @author: Anovem
 * @url: https://www.tlitl.com/
 */

if (typeof jQuery !== "undefined") {
  var $ = jQuery.noConflict();
}

(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    typeof define === 'function' && define.amd ? define(factory) :
      (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.NOVEM = factory());
}(this, (function () {

  // USE STRICT
  "use strict";

  // Start
  var options = {
    pageTransition: false,
    cursor: false,
    tips: false,
    headerSticky: true,
    headerMobileSticky: false,
    menuBreakpoint: 1200,
    pageMenuBreakpoint: 1200,
    bdhmID: "186aa1bb1368d7e0c66d1ea6e3f590ad",
    pwa: true,
    search: {
      // /aop_views/search/modules/resultpc/soso.html || /aop_views/search/modules/resultpcall/soso.html
      url: "/aop_views/search/modules/resultpc/soso.html",
      query: {
        owner: "2049849536",
        token: "tourist",
        // aop_web || aop_component
        urlPrefix: "/aop_web/",
        lang: "i18n_zh_CN",
      },
      encode: true,
    },
    scrollOffset: 80,
    scrollExternalLinks: true,
    smoothScroll: false,
    jsFolder: "js/",
    cssFolder: "css/",
  };

  if (typeof nvmOptions !== "undefined") {
    options = Object.assign({}, options, nvmOptions);
  }

  var vars = {
    baseEl: document,
    elRoot: document.documentElement,
    elHead: document.head,
    elBody: document.body,
    viewport: {
      width: 0,
      height: 0,
    },
    hash: window.location.hash,
    topScrollOffset: 0,
    elWrapper: document.getElementById("wrapper"),
    elHeader: document.getElementById("header"),
    headerClasses: "",
    elHeaderWrap: document.getElementById("header-wrap"),
    headerWrapClasses: "",
    headerHeight: 0,
    headerOffset: 0,
    headerWrapHeight: 0,
    headerWrapOffset: 0,
    elPrimaryMenus: document.querySelectorAll(".primary-menu"),
    elPrimaryMenuTriggers: document.querySelectorAll(".primary-menu-trigger"),
    elPageMenu: document.getElementById("page-menu"),
    pageMenuOffset: 0,
    elSlider: document.getElementById("slider"),
    elFooter: document.getElementById("footer"),
    elAppMenu: document.querySelector(".app-menu"),
    get menuBreakpoint() {
      return (
        this.elBody.getAttribute("data-menu-breakpoint") ||
        options.menuBreakpoint
      );
    },
    get pageMenuBreakpoint() {
      return (
        this.elBody.getAttribute("data-pagemenu-breakpoint") ||
        options.pageMenuBreakpoint
      );
    },
    get customCursor() {
      var value =
        this.elBody.getAttribute("data-custom-cursor") || options.cursor;
      return value == "true" || value === true ? true : false;
    },
    get pageTransition() {
      var value =
        this.elBody.classList.contains("page-transition") ||
        options.pageTransition;
      return value == "true" || value === true ? true : false;
    },
    get tips() {
      var value = this.elBody.getAttribute("data-tips") || options.tips;
      return value == "true" || value === true ? true : false;
    },

    get smoothScroll() {
      var value =
        this.elBody.getAttribute("data-smooth-scroll") || options.smoothScroll;
      return value == "true" || value === true ? true : false;
    },
    scrollPos: {
      x: 0,
      y: 0,
    },
    $jq: typeof jQuery !== "undefined" ? jQuery.noConflict() : "",
    resizers: {},
    recalls: {},
    debounced: false,
    events: {},
    modules: {},
    fn: {},
    required: {
      jQuery: {
        plugin: "jquery",
        fn: function () {
          return typeof jQuery !== "undefined";
        },
        file: options.jsFolder + "plugins/jquery.js",
        id: "nvm-jquery",
      },
    },
    fnInit: function () {
      DocumentOnReady.init();
      DocumentOnLoad.init();
      DocumentOnResize.init();
    },
  };

  var Core = (function () {
    return {
      getOptions: options,
      getVars: vars,

      run: function (obj) {
        Object.values(obj).map(function (fn) {
          return typeof fn === "function" && fn.call();
        });
      },

      runBase: function () {
        Core.run(Base);
      },

      runModules: function () {
        Core.run(Modules);
      },

      runContainerModules: function (parent) {
        if (typeof parent === "undefined") {
          return false;
        }

        Core.getVars.baseEl = parent;
        Core.runModules();
        Core.getVars.baseEl = document;
      },

      browsersupport: function () {
        var isBrowserSupportedForNovem = function () {
          // Feature detection for key Novem requirements
          var features = {
            arrowFunctions: () => {
              try {
                new Function("() => {}");
                return true;
              } catch (e) {
                return false;
              }
            },
            const: () => {
              try {
                new Function("const a = 1");
                return true;
              } catch (e) {
                return false;
              }
            },
            promises: () => typeof Promise !== "undefined",
            proxy: () => typeof Proxy !== "undefined",
            symbol: () => typeof Symbol !== "undefined",
            templateLiteral: () => {
              try {
                new Function("`test`");
                return true;
              } catch (e) {
                return false;
              }
            },
          };

          // Check if all required features are supported
          for (var key in features) {
            if (features.hasOwnProperty(key) && !features[key]()) {
              return false;
            }
          }
          return true;
        };
        if (!isBrowserSupportedForNovem()) {
          // console.log("This browser may not fully support Novem");
          const upgradeNotice = document.createElement("div");
          upgradeNotice.className = "upgrade__notice";
          upgradeNotice.textContent = "为了最好的浏览体验，请升级您的浏览器";
          upgradeNotice.style =
            "line-height: 48px; background-color: #bd9f68; font-size: 16px; color: rgba(255, 255, 255, 1); text-align: center; position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;";
          document.body.appendChild(upgradeNotice);
        } else {
          // console.log("This browser fully support Novem");
        }
      },

      breakpoints: function () {
        var viewWidth = Core.viewport().width;

        var breakpoint = {
          xxl: {
            enter: 1400,
            exit: 99999,
          },
          xl: {
            enter: 1200,
            exit: 1399,
          },
          lg: {
            enter: 992,
            exit: 1199.98,
          },
          md: {
            enter: 768,
            exit: 991.98,
          },
          sm: {
            enter: 576,
            exit: 767.98,
          },
          xs: {
            enter: 0,
            exit: 575.98,
          },
        };

        var previous = "";

        Object.keys(breakpoint).forEach(function (key) {
          if (
            viewWidth > breakpoint[key].enter &&
            viewWidth <= breakpoint[key].exit
          ) {
            vars.elBody.classList.add("device-" + key);
          } else {
            vars.elBody.classList.remove("device-" + key);
            if (previous != "") {
              vars.elBody.classList.remove("device-down-" + previous);
            }
          }

          if (viewWidth <= breakpoint[key].exit) {
            if (previous != "") {
              vars.elBody.classList.add("device-down-" + previous);
            }
          }

          previous = key;

          if (viewWidth > breakpoint[key].enter) {
            vars.elBody.classList.add("device-up-" + key);
            return;
          } else {
            vars.elBody.classList.remove("device-up-" + key);
          }
        });
      },

      colorScheme: function () {
        if (vars.elBody.classList.contains("adaptive-color-scheme")) {
          window.matchMedia("(prefers-color-scheme: dark)").matches
            ? vars.elBody.classList.add("dark")
            : vars.elBody.classList.remove("dark");
        }

        var bodyColorScheme = Core.cookie.get("__nvm_body_color_scheme");

        if (bodyColorScheme && bodyColorScheme != "") {
          bodyColorScheme.split(" ").includes("dark")
            ? vars.elBody.classList.add("dark")
            : vars.elBody.classList.remove("dark");
        }
      },

      throttle: function (timer, func, delay) {
        if (timer) {
          return;
        }

        timer = setTimeout(function () {
          func();
          timer = undefined;
        }, delay);
      },

      debounce: function (callback, delay) {
        clearTimeout(vars.debounced);
        vars.debounced = setTimeout(callback, delay);
      },

      debouncedResize: function (func, delay) {
        var timeoutId;
        return function () {
          var context = this;
          var args = arguments;
          clearTimeout(timeoutId);
          timeoutId = setTimeout(function () {
            func.apply(context, args);
          }, delay);
        };
      },

      addEvent: function (el, event, args = {}) {
        if (typeof el === "undefined" || typeof event === "undefined") {
          return;
        }

        var createEvent = new CustomEvent(event, {
          detail: args,
        });

        el.dispatchEvent(createEvent);
        vars.events[event] = true;
      },

      scrollEnd: function (callback, refresh = 199) {
        if (!callback || typeof callback !== "function") return;

        window.addEventListener(
          "scroll",
          function () {
            Core.debounce(callback, refresh);
          },
          { passive: true }
        );
      },

      viewport: function () {
        var viewport = {
          width: window.innerWidth || vars.elRoot.clientWidth,
          height: window.innerHeight || vars.elRoot.clientHeight,
        };

        vars.viewport = viewport;

        document.documentElement.style.setProperty(
          "--nvm-viewport-width",
          viewport.width
        );
        document.documentElement.style.setProperty(
          "--nvm-viewport-height",
          viewport.height
        );
        document.documentElement.style.setProperty(
          "--nvm-body-height",
          vars.elBody.clientHeight
        );

        return viewport;
      },

      isElement: function (selector) {
        if (typeof selector === "object" && selector !== null) {
          return true;
        }

        if (selector instanceof Element || selector instanceof HTMLElement) {
          return true;
        }

        if (typeof selector.jquery !== "undefined") {
          selector = selector[0];
        }

        if (typeof selector.nodeType !== "undefined") {
          return true;
        }

        return false;
      },

      getSelector: function (selector, jquery = true, customjs = true) {
        if (jquery) {
          if (Core.getVars.baseEl !== document) {
            selector = jQuery(Core.getVars.baseEl).find(selector);
          } else {
            selector = jQuery(selector);
          }

          if (customjs) {
            if (typeof customjs == "string") {
              selector = selector.filter(":not(" + customjs + ")");
            } else {
              selector = selector.filter(":not(.customjs)");
            }
          }
        } else {
          if (Core.isElement(selector)) {
            selector = selector;
          } else {
            if (customjs) {
              if (typeof customjs == "string") {
                selector = Core.getVars.baseEl.querySelectorAll(
                  selector + ":not(" + customjs + ")"
                );
              } else {
                selector = Core.getVars.baseEl.querySelectorAll(
                  selector + ":not(.customjs)"
                );
              }
            } else {
              selector = Core.getVars.baseEl.querySelectorAll(selector);
            }
          }
        }

        return selector;
      },

      onResize: function (callback, refresh = 333) {
        if (!callback || typeof callback !== "function") return;

        window.addEventListener("resize", function () {
          Core.debounce(callback, refresh);
        });
      },

      imagesLoaded: function (el) {
        var imgs = el.getElementsByTagName("img") || document.images,
          len = imgs.length,
          counter = 0;

        if (len < 1) {
          Core.addEvent(el, "NovemImagesLoaded");
        }

        var incrementCounter = async function () {
          counter++;
          if (counter === len) {
            Core.addEvent(el, "NovemImagesLoaded");
          }
        };

        [].forEach.call(imgs, function (img) {
          if (img.complete) {
            incrementCounter();
          } else {
            img.addEventListener("load", incrementCounter, false);
          }
        });
      },

      contains: function (classes, selector) {
        var classArray = classes.split(" ");
        var hasClass = false;

        classArray.forEach(function (classTxt) {
          if (vars.elBody.classList.contains(classTxt)) {
            hasClass = true;
          }
        });

        return hasClass;
      },

      has: function (nodeList, selector) {
        return [].slice.call(nodeList)?.filter(function (e) {
          return e.querySelector(selector);
        });
      },

      filtered: function (nodeList, selector) {
        return [].slice.call(nodeList)?.filter(function (e) {
          return e.matches(selector);
        });
      },

      parents: function (elem, selector) {
        if (!Element.prototype.matches) {
          Element.prototype.matches =
            Element.prototype.matchesSelector ||
            Element.prototype.mozMatchesSelector ||
            Element.prototype.msMatchesSelector ||
            Element.prototype.oMatchesSelector ||
            Element.prototype.webkitMatchesSelector ||
            function (s) {
              var matches = (
                this.document || this.ownerDocument
              ).querySelectorAll(s),
                i = matches.length;
              while (--i >= 0 && matches.item(i) !== this) { }
              return i > -1;
            };
        }

        var parents = [];

        for (; elem && elem !== document; elem = elem.parentNode) {
          if (selector) {
            if (elem.matches(selector)) {
              parents.push(elem);
            }
            continue;
          }
          parents.push(elem);
        }

        return parents;
      },

      siblings: function (elem, nodes = false) {
        if (nodes) {
          return [].slice.call(nodes).filter(function (sibling) {
            return sibling !== elem;
          });
        } else {
          return [].slice
            .call(elem.parentNode.children)
            .filter(function (sibling) {
              return sibling !== elem;
            });
        }
      },

      getNext: function (elem, selector) {
        var nextElem = elem.nextElementSibling;

        if (!selector) {
          return nextElem;
        }

        if (nextElem && nextElem.matches(selector)) {
          return nextElem;
        }

        return null;
      },

      offset: function (el) {
        var rect = el.getBoundingClientRect(),
          scrollLeft = window.scrollX || document.documentElement.scrollLeft,
          scrollTop = window.scrollY || document.documentElement.scrollTop;

        return { top: rect.top + scrollTop, left: rect.left + scrollLeft };
      },

      isHidden: function (el) {
        return el.offsetParent === null;
      },

      classesFn: function (func, classes, selector) {
        var classArray = classes.split(" ");
        classArray.forEach(function (classTxt) {
          if (func == "add") {
            selector.classList.add(classTxt);
          } else if (func == "toggle") {
            selector.classList.toggle(classTxt);
          } else {
            selector.classList.remove(classTxt);
          }
        });
      },

      cookie: (function () {
        return {
          set: function (name, value, daysToExpire) {
            var date = new Date();
            date.setTime(date.getTime() + daysToExpire * 24 * 60 * 60 * 1000);
            var expires = "expires=" + date.toUTCString();
            document.cookie = name + "=" + value + ";" + expires + ";path=/";
          },

          get: function (name) {
            var decodedCookies = decodeURIComponent(document.cookie);
            var cookies = decodedCookies.split(";");

            for (let i = 0; i < cookies.length; i++) {
              var cookie = cookies[i].trim();
              if (cookie.startsWith(name + "=")) {
                return cookie.substring(name.length + 1);
              }
            }

            return null;
          },

          remove: function (name) {
            document.cookie =
              name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
          },
        };
      })(),

      scrollTo: function (
        offset = 0,
        speed = 1250,
        easing,
        behavior = "smooth"
      ) {
        if (
          easing &&
          typeof jQuery !== "undefined" &&
          typeof jQuery.easing["easeOutQuad"] !== "undefined"
        ) {
          jQuery("body,html")
            .stop(true)
            .animate(
              {
                scrollTop: Number(offset),
              },
              Number(speed),
              easing
            );
        } else {
          var smoothScroll = "scrollBehavior" in document.documentElement.style;

          if (typeof window.scroll === "function" && smoothScroll) {
            window.scroll({
              top: Number(offset),
              behavior: behavior,
            });
          } else {
            var body = Core.getVars.elBody;
            var rootEl = Core.getVars.elRoot;

            body.scrollIntoView();
            rootEl.scrollIntoView();

            var scrollToTop = function () {
              if (
                body.scrollTop > Number(offset) ||
                rootEl.scrollTop > Number(offset)
              ) {
                body.scrollTop -= 20;
                rootEl.scrollTop -= 20;
                setTimeout(scrollToTop, 10);
              }
            };

            scrollToTop();
          }
        }
      },

      smoothScroll: function () {
        new initSmoothScrollfunction(document, 90, 5);

        function initSmoothScrollfunction(target, speed, smooth) {
          if (target === document)
            target =
              document.scrollingElement ||
              document.documentElement ||
              document.body.parentNode ||
              document.body; // cross browser support for document scrolling

          var moving = false;
          var pos = target.scrollTop;
          var frame =
            target === document.body && document.documentElement
              ? document.documentElement
              : target; // safari is the new IE

          target.addEventListener("wheel", scrolled, { passive: false });

          function scrolled(e) {
            e.preventDefault(); // disable default scrolling

            var delta = normalizeWheelDelta(e);

            pos += -delta * speed;
            pos = Math.max(
              0,
              Math.min(pos, target.scrollHeight - frame.clientHeight)
            ); // limit scrolling

            if (!moving) update();
          }

          function normalizeWheelDelta(e) {
            if (e.detail) {
              if (e.wheelDelta)
                return (e.wheelDelta / e.detail / 40) * (e.detail > 0 ? 1 : -1);
              // Opera
              else return -e.detail / 3; // Firefox
            } else return e.wheelDelta / 120; // IE,Safari,Chrome
          }

          function update() {
            moving = true;

            var delta = (pos - target.scrollTop) / smooth;

            target.scrollTop += delta;

            if (Math.abs(delta) > 0.5) requestFrame(update);
            else moving = false;
          }

          var requestFrame = (function () {
            // requestAnimationFrame cross browser
            return (
              window.requestAnimationFrame ||
              window.webkitRequestAnimationFrame ||
              window.mozRequestAnimationFrame ||
              window.oRequestAnimationFrame ||
              window.msRequestAnimationFrame ||
              function (func) {
                window.setTimeout(func, 1000 / 50);
              }
            );
          })();
        }
      },

      loadCSS: function (params) {
        var file = params.file;
        var htmlID = params.id || false;
        var cssFolder = params.cssFolder || false;

        if (!file) {
          return false;
        }

        if (htmlID && document.getElementById(htmlID)) {
          return false;
        }

        var htmlStyle = document.createElement("link");

        htmlStyle.id = htmlID;
        htmlStyle.href = cssFolder ? options.cssFolder + file : file;
        htmlStyle.rel = "stylesheet";
        htmlStyle.type = "text/css";

        vars.elHead.appendChild(htmlStyle);
        return true;
      },

      loadJS: function (params) {
        var file = params.file;
        var htmlID = params.id || false;
        var type = params.type || false;
        var callback = params.callback;
        var async = params.async || true;
        var defer = params.defer || true;
        var jsFolder = params.jsFolder || false;

        if (!file) {
          return false;
        }

        if (htmlID && document.getElementById(htmlID)) {
          return false;
        }

        var htmlScript = document.createElement("script");

        if (typeof callback !== "undefined") {
          if (typeof callback != "function") {
            throw new Error("Not a valid callback!");
          } else {
            htmlScript.onload = callback;
          }
        }

        htmlScript.id = htmlID;
        htmlScript.src = jsFolder ? options.jsFolder + file : file;
        if (type) {
          htmlScript.type = type;
        }
        htmlScript.async = async ? true : false;
        htmlScript.defer = defer ? true : false;

        vars.elBody.appendChild(htmlScript);
        return true;
      },

      isFuncTrue: async function (fn) {
        if ("function" !== typeof fn) {
          return false;
        }

        var counter = 0;

        return new Promise(function (resolve, reject) {
          if (fn()) {
            resolve(true);
          } else {
            var int = setInterval(function () {
              if (fn()) {
                clearInterval(int);
                resolve(true);
              } else {
                if (counter > 30) {
                  clearInterval(int);
                  reject(true);
                }
              }
              counter++;
            }, 333);
          }
        }).catch(function (error) {
          console.log("Function does not exist: " + fn);
        });
      },

      initFunction: function (params) {
        vars.elBody.classList.add(params.class);
        Core.addEvent(window, params.event);
        vars.events[params.event] = true;
      },

      runModule: function (params) {
        var pluginName = params.plugin.toLowerCase();
        var moduleFile = options.jsFolder + "components/" + pluginName + ".js";

        if (params.file) {
          moduleFile = params.file;
        }

        var pluginCheck = function () {
          return typeof NVM[params.plugin] !== "undefined";
        };

        if (!pluginCheck()) {
          Core.loadJS({
            file: moduleFile,
            id: "nvm-" + pluginName + "-fn",
          });

          Core.isFuncTrue(pluginCheck).then(function (cond) {
            if (!cond) {
              return false;
            }

            NVM[params.plugin].init(params.selector);
          });
        } else {
          NVM[params.plugin].init(params.selector);
        }

        return true;
      },

      initModule: function (params) {
        if ("dependent" != params.selector) {
          if (typeof params.selector === "object") {
            if (params.selector instanceof jQuery) {
              params.selector = params.selector[0];
            }

            var _el = params.selector;
          } else {
            var _el = Core.getVars.baseEl.querySelectorAll(params.selector);
          }

          if (_el.length < 1) {
            return false;
          }
        }

        var required = true;
        var dependentActive = true;

        if (params.required && Array.isArray(params.required)) {
          var requireAll = {};
          params.required.forEach(function (req) {
            return (requireAll[req.plugin] = !req.fn() ? false : true);
          });

          params.required.forEach(function (req) {
            if (!req.fn()) {
              required = false;
              var getjQuery = (async function () {
                Core.loadJS({ file: req.file, id: req.id });

                var funcAvailable = new Promise(function (resolve) {
                  var int = setInterval(function () {
                    if (req.fn()) {
                      requireAll[req.plugin] = true;
                      var allTrue = Object.values(requireAll).every(function (
                        value
                      ) {
                        return value === true;
                      });

                      if (allTrue) {
                        clearInterval(int);
                        resolve(true);
                      }
                    }
                  }, 333);
                });

                required = await funcAvailable;
                Core.runModule(params);
              })();
            }
          });
        }

        if (
          typeof params.dependency !== "undefined" &&
          typeof params.dependency === "function"
        ) {
          dependentActive = false;
          var runDependent = async function () {
            var depAvailable = new Promise(function (resolve) {
              if (params.dependency.call(params, "dependent") == true) {
                resolve(true);
              }
            });
            return await depAvailable;
          };
          dependentActive = runDependent();
        }

        if (required && dependentActive) {
          Core.runModule(params);
        }

        return true;
      },

      topScrollOffset: function () {
        var headerHeight = 0;
        var pageMenuOffset =
          vars.elPageMenu?.querySelector("#page-menu-wrap")?.offsetHeight || 0;

        if (vars.elBody.classList.contains("is-expanded-menu")) {
          if (vars.elHeader?.classList.contains("sticky-header")) {
            headerHeight = vars.elHeaderWrap.offsetHeight;
          }

          if (
            vars.elPageMenu?.classList.contains("dots-menu") ||
            !vars.elPageMenu?.classList.contains("sticky-page-menu")
          ) {
            pageMenuOffset = 0;
          }
        }

        Core.getVars.topScrollOffset =
          headerHeight + pageMenuOffset + options.scrollOffset;
      },
    };
  })();

  var Base = (function () {
    return {
      init: function () {
        Mobile.any() && vars.elBody.classList.add("device-touch");
      },

      menuBreakpoint: function () {
        if (Core.getVars.menuBreakpoint <= Core.viewport().width) {
          vars.elBody.classList.add("is-expanded-menu");
        } else {
          vars.elBody.classList.remove("is-expanded-menu");
        }

        if (vars.elPageMenu) {
          if (typeof Core.getVars.pageMenuBreakpoint === "undefined") {
            Core.getVars.pageMenuBreakpoint = Core.getVars.menuBreakpoint;
          }

          if (Core.getVars.pageMenuBreakpoint <= Core.viewport().width) {
            vars.elBody.classList.add("is-expanded-pagemenu");
          } else {
            vars.elBody.classList.remove("is-expanded-pagemenu");
          }
        }
      },

      goToTop: function () {
        return Core.initModule({ selector: "#gotoTop", plugin: "GoToTop" });
      },

      stickyFooter: function () {
        return Core.initModule({
          selector: ".sticky-footer",
          plugin: "StickyFooter",
        });
      },

      // logo: function () {
      //   return Core.initModule({ selector: "#logo", plugin: "Logo" });
      // },

      headers: function () {
        Core.getVars.headerClasses = vars.elHeader?.className || "";
        Core.getVars.headerWrapClasses = vars.elHeaderWrap?.className || "";
        return Core.initModule({ selector: "#header", plugin: "Headers" });
      },

      menus: function () {
        return Core.initModule({ selector: "#header", plugin: "Menus" });
      },

      pageMenu: function () {
        return Core.initModule({
          selector: "#page-menu",
          plugin: "PageMenu",
        });
      },

      topSearch: function () {
        return Core.initModule({
          selector: "#top-search-trigger",
          plugin: "TopSearch",
        });
      },

      sidePanel: function () {
        return Core.initModule({
          selector: "#side-panel",
          plugin: "SidePanel",
        });
      },

      adaptiveColorScheme: function () {
        return Core.initModule({
          selector: ".adaptive-color-scheme",
          plugin: "AdaptiveColorScheme",
        });
      },

      cursor: function () {
        if (vars.customCursor) {
          return Core.initModule({ selector: "body", plugin: "Cursor" });
        }
      },

      setBSTheme: function () {
        if (vars.elBody.classList.contains("dark")) {
          document.querySelector("html").setAttribute("data-bs-theme", "dark");
        } else {
          document.querySelector("html").removeAttribute("data-bs-theme");
          document.querySelectorAll(".dark")?.forEach(function (el) {
            el.setAttribute("data-bs-theme", "dark");
          });
        }

        vars.elBody.querySelectorAll(".not-dark")?.forEach(function (el) {
          el.setAttribute("data-bs-theme", "light");
        });
      },
    };
  })();

  var Modules = (function () {
    return {
      easing: function () {
        return Core.initModule({
          selector: "[data-easing]",
          plugin: "Easing",
          required: [vars.required.jQuery],
        });
      },

      bootstrap: function () {
        var notExec = true;
        document.querySelectorAll("*").forEach(function (el) {
          if (notExec) {
            el.getAttributeNames().some(function (text) {
              if (text.includes("data-bs")) {
                notExec = false;
                return Core.initModule({
                  selector: "body",
                  plugin: "Bootstrap",
                });
              }
            });
          }
        });
      },

      pageTransition: function () {
        if (vars.pageTransition) {
          return Core.initModule({
            selector: "body",
            plugin: "PageTransition",
          });
        }
      },

      lazyLoad: function (element) {
        return Core.initModule({
          selector: element ? element : ".lazy:not(.lazy-loaded)",
          plugin: "LazyLoad",
        });
      },

      // pwa: function (element) {
      //   return Core.initModule({
      //     selector: element ? element : "[data-pwa]",
      //     plugin: "PWA",
      //   });
      // },
      fiveBar: function () {
        return Core.initModule({
          selector: ".fivebar",
          plugin: "FiveBar",
        });
      },

      dataClasses: function () {
        return Core.initModule({
          selector: "[data-class]",
          plugin: "DataClasses",
        });
      },

      dataHeights: function () {
        return Core.initModule({
          selector:
            "[data-height-xxl],[data-height-xl],[data-height-lg],[data-height-md],[data-height-sm],[data-height-xs]",
          plugin: "DataHeights",
        });
      },

      lightbox: function (element) {
        return Core.initModule({ selector: element ? element : '[data-lightbox]', plugin: 'Lightbox', required: [vars.required.jQuery] });
      },

      animations: function (element) {
        return Core.initModule({
          selector: element ? element : "[data-animate]",
          plugin: "Animations",
        });
      },

      hoverAnimations: function (element) {
        return Core.initModule({
          selector: element ? element : "[data-hover-animate]",
          plugin: "HoverAnimations",
        });
      },

      gridInit: function (element) {
        return Core.initModule({ selector: element ? element : '.grid-container', plugin: 'Grid' });
      },

      filterInit: function (element) {
        return Core.initModule({ selector: element ? element : '.custom-filter', plugin: 'Filter' });
      },

      novemSlider: function (element) {
        return Core.initModule({
          selector: element ? element : ".slider-element",
          plugin: "NovemSlider",
        });
      },

      iconVivus: function (element) {
        return Core.initModule({
          selector: element ? element : ".icon-vivus",
          plugin: "Vivus",
        });
      },

      PanoramaPannellum: function (element) {
        return Core.initModule({
          selector: element ? element : ".panorama",
          plugin: "Pannellum",
        });
      },

      html5Video: function (element) {
        return Core.initModule({
          selector: element ? element : ".video-wrap",
          plugin: "FullVideo",
        });
      },

      progress: function (element) {
        return Core.initModule({
          selector: element ? element : ".skill-progress",
          plugin: "Progress",
        });
      },

      onePage: function (element) {
        return Core.initModule({
          selector: element ? element : "[data-scrollto],.one-page-menu",
          plugin: "OnePage",
        });
      },

      conditional: function (element) {
        return Core.initModule({
          selector: element
            ? element
            : ".form-group[data-condition],.form-group[data-conditions]",
          plugin: "Conditional",
        });
      },

      cookies: function (element) {
        return Core.initModule({
          selector: element ? element : "[data-cookies]",
          plugin: "Cookies",
        });
      },

      readmore: function (element) {
        return Core.initModule({
          selector: element ? element : "[data-readmore]",
          plugin: "ReadMore",
        });
      },

      ajaxTrigger: function (element) {
        return Core.initModule({
          selector: element ? element : "[data-ajax-loader]",
          plugin: "AjaxTrigger",
        });
      },

      videoFacade: function (element) {
        return Core.initModule({
          selector: element ? element : ".video-facade",
          plugin: "VideoFacade",
        });
      },

      schemeToggle: function (element) {
        return Core.initModule({
          selector: element ? element : ".body-scheme-toggle",
          plugin: "SchemeToggle",
        });
      },

      clipboardCopy: function (element) {
        return Core.initModule({
          selector: element ? element : ".nvm-clipboard",
          plugin: "Clipboard",
        });
      },

      codeHighlight: function (element) {
        return Core.initModule({
          selector: element ? element : ".code-highlight",
          plugin: "CodeHighlight",
        });
      },

      tips: function () {
        if (vars.tips) {
          return Core.initModule({ selector: "body", plugin: "Tips" });
        }
      },

      textSplitter: function (element) {
        return Core.initModule({
          selector: element ? element : ".text-splitter",
          plugin: "TextSplitter",
        });
      },

      mediaActions: function (element) {
        return Core.initModule({
          selector: element ? element : ".media-wrap",
          plugin: "MediaActions",
        });
      },

      viewportDetect: function (element) {
        return Core.initModule({
          selector: element ? element : ".viewport-detect",
          plugin: "ViewportDetect",
        });
      },

      scrollDetect: function (element) {
        return Core.initModule({
          selector: element ? element : ".scroll-detect",
          plugin: "ScrollDetect",
        });
      },

      fontSizer: function (element) {
        return Core.initModule({
          selector: element ? element : ".font-sizer",
          plugin: "FontSizer",
        });
      },

      hover3D: function (element) {
        return Core.initModule({
          selector: element ? element : ".hover-3d",
          plugin: "Hover3D",
        });
      },

      buttons: function (element) {
        return Core.initModule({
          selector: element ? element : ".button-text-effect",
          plugin: "Buttons",
        });
      },

      socialShare: function (element) {
        return Core.initModule({
          selector: element ? element : '.share',
          plugin: 'SocialShare',
        });
      },

      scrollSnap: function (element) {
        return Core.initModule({
          selector: element ? element : "[data-scrollsnap]",
          plugin: "ScrollSnap",
        });
      },

      tocBot: function (element) {
        return Core.initModule({
          selector: element ? element : ".toc",
          plugin: "TocBot",
        });
      },

      sliderMajor: function (element) {
        return Core.initModule({
          selector: element ? element : ".major", plugin: "SliderMajor",
        });
      },

      accordion: function (element) {
        return Core.initModule({
          selector: element ? element : ".accordion", plugin: "Accordion",
        });
      },

      bsComponents: function (element) {
        return Core.initModule({
          selector: element
            ? element
            : '[data-bs-toggle="tooltip"],[data-bs-toggle="popover"],[data-bs-toggle="tab"],[data-bs-toggle="pill"],.style-msg',
          plugin: "BSComponents",
        });
      },
    };
  })();

  var Mobile = (function () {
    return {
      Android: function () {
        return navigator.userAgent.match(/Android/i);
      },
      BlackBerry: function () {
        return navigator.userAgent.match(/BlackBerry/i);
      },
      iOS: function () {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
      },
      Opera: function () {
        return navigator.userAgent.match(/Opera Mini/i);
      },
      Windows: function () {
        return navigator.userAgent.match(/IEMobile/i);
      },
      any: function () {
        return (
          Mobile.Android() ||
          Mobile.BlackBerry() ||
          Mobile.iOS() ||
          Mobile.Opera() ||
          Mobile.Windows()
        );
      },
    };
  })();

  // Add your Custom JS Codes here
  var Custom = (function () {
    return {
      onReady: function () {
        // Add JS Codes here to Run on Document Ready
      },

      onLoad: function () {
        // Add JS Codes here to Run on Window Load
      },

      onResize: function () {
        // Add JS Codes here to Run on Window Resize
      },
    };
  })();

  var DocumentOnResize = (function () {
    return {
      init: function () {
        Core.viewport();
        Core.breakpoints();
        Base.menuBreakpoint();

        Core.run(vars.resizers);

        Custom.onResize();
        Core.addEvent(window, "nvmResize");
      },
    };
  })();

  var DocumentOnReady = (function () {
    return {
      init: function () {
        Core.browsersupport();
        Core.breakpoints();
        Core.colorScheme();
        Core.runBase();
        Core.runModules();
        Core.topScrollOffset();

        if (vars.smoothScroll) {
          new Core.smoothScroll();
        }

        DocumentOnReady.windowscroll();

        Custom.onReady();
      },

      windowscroll: function () {
        Core.scrollEnd(function () {
          Base.pageMenu();
        });
      },
    };
  })();

  var DocumentOnLoad = (function () {
    return {
      init: function () {
        // PWA
        if (options.pwa) {
          // bootstrap
          Core.loadJS({
            file: "plugins/bootstrap.js",
            id: "nvm-bootstrap-js",
            jsFolder: true,
          });

          // pwa
          Core.loadJS({
            file: "plugins/pwa.js",
            id: "nvm-pwa-js",
            jsFolder: true,
          });
        }
        // Baidu 颗粒归仓
        if (options.bdhmID) {
          // Baidu Start
          var _hmt = _hmt || [];
          (function () {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?" + options.bdhmID; // 替换成自己的
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
          })();
          // Baidu End
          // Core.loadJS({
          //   file: "https://hm.baidu.com/hm.js?=" + options.bdhmID,
          //   id: "nvm-baidutongji-js",
          // });
        }

        Custom.onLoad();
      },
    };
  })();

  document.addEventListener("DOMContentLoaded", function () {
    DocumentOnReady.init();
  });

  window.addEventListener("load", function () {
    DocumentOnLoad.init();
  });

  var resizeFunctions = Core.debouncedResize(function () {
    DocumentOnResize.init();
  }, 250);

  window.addEventListener("resize", function () {
    resizeFunctions();
  });

  var novem_umd = {
    Core,
    Base,
    Modules,
    Mobile,
    Custom,
  };

  return novem_umd;
  // End
})));

(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    typeof define === 'function' && define.amd ? define(factory) :
      (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.NVM = factory());
}(this, (function () {
  // USE STRICT
  "use strict";

  /**
   * --------------------------------------------------------------------------
   * DO NOT DELETE!! Start (Required)
   * --------------------------------------------------------------------------
   */
  if (
    NOVEM === "undefined" ||
    NOVEM.Core === "undefined" ||
    NOVEM.Base === "undefined" ||
    NOVEM.Modules === "undefined" ||
    NOVEM.Mobile === "undefined"
  ) {
    return false;
  }

  return {};
  // End
})));